<?php
	$template->_template_read("System/Design/Templates/rename.html");
	// Grundlegende Sprach-Strings-Einsetzen
	$template->_template_assign("CAPTION_REN1", (string)$language->texts->value_1);
	$template->_template_assign("CAPTION_REN7", (string)$language->legends->value_5);
	$template->_template_assign("CAPTION_REN8", (string)$language->legends->value_6);
	$template->_template_assign("CAPTION_REN10", (string)$language->legends->value_6);
	$template->_template_assign("CAPTION_REN11", (string)$language->common->value_26);
	
	$head->_template_assign("TITEL", (string)$language->legends->value_6);
	$face = path_compl($_GET["file"]);
	if(isset($_GET["ren"])){
		$ren = $_GET["ren"];
	} else {
		$ren = "start";
	}
	if (!is_restricted($face)){
		switch($ren){
			case "1":
				$pathinfo_new = pathinfo($_POST["new_name"]);
				$compl_old = $_GET["path"]."/".$_GET["file"];
				$compl_new = $_GET["path"]."/".$pathinfo_new["basename"];
				if (!file_exists ($compl_new)){
					if (rename($compl_old, $compl_new)){
						oyster_log("SUCCESS", (string)$language->stati->value_2, "Oyster rename.include");
						$head->_template_assign("STATUS", (string)$language->stati->value_2);
					} else {
						oyster_log("ERROR", (string)$language->errors->value_10, "Oyster rename.include");
						$head->_template_assign("ERROR", (string)$language->errors->value_10);
					}
					if (ALLOW_EASY_MOVE == true){
						build_foldersDB();
					}
				} else {
					oyster_log("ERROR", (string)$language->errors->value_11, "Oyster rename.include");
					$head->_template_assign("ERROR", (string)$language->errors->value_11);
				}
				$ordner = $_GET["path"];
				$included = true;
				include("System/Kernel/Includes/index.include.php");
			break;
			default:
				$template->_template_assign("INPUT", "true");
				$template->_template_assign("BEZEICHNUNG", $_GET["file"]);
				$template->_template_assign("FOLDER", $_GET["path"]);
				$template->_template_assign("CAPTION_REN9", sprintf((string)$language->common->value_25,$_GET["file"],$_GET["path"]));
		}
	} else {
		oyster_log("ERROR", (string)$language->errors->value_3, "Oyster rename.include");
		$head->_template_assign("ERROR", (string)$language->errors->value_3);
		$ordner = $_GET["path"];
		$included = true;
		include("System/Kernel/Includes/index.include.php");
	}
?>